#include <iostream>
#include <cstdio>
using namespace std;
int a[105][105];
int main(){
	int n,num=0;
	cin>>n;
	int x=1,y=1,d=1;
	while(num<n*n){
		num++;
		a[x][y]=num;
	//	printf("x:%d y:%d num:%d\n",x,y,num);
		if(d){
			if(x==n&&x+y>=n+1){
				
				y++;
				d=0;
				continue;
			}
			if(y==1){
				x++;
				d=0;
			}else{
				x++;
				y--;
			}
				
		}else{
			if(y==n&&x+y>=n+1){
				d=1;
				x++;
				continue;
			}
			if(x==1){
				y++;
				d=1;
			}else{
				x--;
				y++;
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}
